import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { fileURLToPath, URL } from 'node:url';
import { protocol } from 'socket.io-client';

export default defineConfig({
  plugins: [
    vue(),
    // 其他插件
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    },
  },
  server: {
    proxy: {
       //前端服务启动的端口号
        protocol: 'http', //协议，默认http
        https: false,
        '/api': {
          target: 'http://localhost:8888',
          changeOrigin: true,
          rewrite: (path) => path.replace(/^\/api/, ''),
        }
    }
  }
});